package com.ybc.chinese.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * <p>时间工具<p/>
 * Created by Yubch on 17/3/9.
 */
public class DateUtil {

    /**
     * 获取距离高考的时间
     * @return
     */
    public static int getCollegeDays() throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date college =  sdf.parse("2017-06-07");
        Calendar cal = Calendar.getInstance();
        cal.setTime(college);
        long collegeTime = cal.getTimeInMillis();
        long betweenDays = (collegeTime - System.currentTimeMillis()) /(1000*3600*24);
        return Integer.parseInt(String.valueOf(betweenDays));
    }

}
